Track BackupEngine and BackupStorageHandle errors together.#6350
Merged
deepthi merged 8 commits intovitessio:masterfrom Jun 22, 2020
Merged
Track BackupEngine and BackupStorageHandle errors together.#6350deepthi merged 8 commits intovitessio:masterfrom
deepthi merged 8 commits intovitessio:masterfrom
Conversation
added 5 commits
June 21, 2020 09:14
(Yes, I need to document, and also fix the interface implementation for all the other implementations of BackupHandle) Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
The `s3iface` type is an interface listing all the methods that the `s3` struct implements, with the added benefit of being able to swap in mock implementations in tests. Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
deepthi
suggested changes
Jun 22, 2020
Collaborator
deepthi
left a comment
There was a problem hiding this comment.
Nice work! +100 for writing a unit test.
It will be nice to reword the long comment so that it works as a standalone explanation without reference to the diff.
Co-authored-by: Deepthi Sigireddi <deepthi.sigireddi@gmail.com> Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
f8952ef to
3c3822c
Compare
deepthi
reviewed
Jun 22, 2020
|
|
||
| wc, err := bh.AddFile(aws.BackgroundContext(), "somefile", 100000) | ||
| require.NoErrorf(t, err, "AddFile() expected no error, got %s", err) | ||
| assert.NotEqual(t, nil, wc, "AddFile() expected non-nil WriteCloser") |
Collaborator
There was a problem hiding this comment.
There's also an assert.NotNil, but I'll accept this.
deepthi
approved these changes
Jun 22, 2020
Signed-off-by: Andrew Mason <amason@slack-corp.com>
ajm188
pushed a commit
to tinyspeck/vitess
that referenced
this pull request
Jun 26, 2020
Track BackupEngine and BackupStorageHandle errors together.
ameetkotian
pushed a commit
to tinyspeck/vitess
that referenced
this pull request
Aug 19, 2020
Track BackupEngine and BackupStorageHandle errors together.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This addresses #6349.
This change requires
BackupHandleto implement theconcurrency.ErrorRecorderinterface in order to guarantee that errors that happen either in the backup engine code or in the backup storage handle code end up in the same place. This provides a single place for builtinbackupengine to check for errors before proceeding with writing the manifest.This also required adding
ErrorRecorderto certain BackupStorage implementations that didn't previously need them (filebackupstorage,gcsbackupstorage), and allowed me to turn simplify some calls (i.e.bh.errors.HasErrors()becomesbh.HasErrors()) in other implemtations (s3backupstorage,azblobbackupstorage,cephbackupstorage).Finally, I added a test for the builtinbackupengine+s3backupstorage error case, which required me to change the typing of
S3BackupHandle.clientfrom*s3.S3to the recommendeds3iface.S3APIwhich is just the interface that*s3.S3implements.